<template>
  <view class="page_box">
    <view class="box">
      <view class="title">充值金额</view>
      <up-input v-model="formData.amont" type="number" class="input_num" fontSize="30rpx" placeholder="请输入数量" border="bottom" clearable>
        <template #prefix> <text style="font-size: 40rpx">￥</text> </template>
      </up-input>
      <view class="des">
        当前余额：
        <text>￥{{ banlanceAmont }}</text>
      </view>
    </view>

    <view class="box">
      <view class="title">
        <text>充值方式</text>
      </view>
      <view class="zfbbox">
        <view class="left">
          <u-icon name="weixin-circle-fill" color="#0abc64" size="30"></u-icon>
          <view class="textBox">
            <view>微信充值</view>
            <view>实时到账</view>
          </view>
        </view>
        <view class="">
          <u-radio-group v-model="radiovalue1" activeColor="#1676fd">
            <u-radio name="1"></u-radio>
          </u-radio-group>
        </view>
      </view>
    </view>
    <u-modal :show="showModal" title="请输入支付密码" showCancelButton @confirm="pay" @cancel="closeFn">
      <view class="popbox">
        <u-input v-model="payPassword" placeholder="请输入支付密码" clearable :password="isPass">
          <template #suffix>
            <u-icon name="eye-off" color="#bfbfbf" size="28" v-if="isPass" @click="isPass = false"></u-icon>
            <u-icon name="eye" color="#bfbfbf" size="28" v-else @click="isPass = true"></u-icon>
          </template>
        </u-input>
      </view>
    </u-modal>
    <view class="buttomBox">
      <u-button type="primary" color="#1676fd" shape="circle" @click="submit">立即充值</u-button>
    </view>
  </view>
</template>

<script lang="ts" setup>
import { onBeforeMount, ref } from "vue";
const { banlanceAmont } = defineProps<{
  banlanceAmont: string;
}>();
const showModal = ref(false);
const payPassword = ref(null);
const formData = ref({
  amont: 0,
  userId: uni.getStorageSync("userId"),
});
const isPass = ref(true);
const radiovalue1 = ref("1");
const submit = () => {
  if (!formData.value.amont) {
    uni.showToast({
      title: "余额不能为0",
      icon: "none",
    });
    return;
  }
  showModal.value = true;
};
const closeFn = () => {
  showModal.value = false;
  payPassword.value = null;
};
const pay = async () => {
  uni.showToast({
    title: "提现成功",
    complete: () => {
      setTimeout(() => {
        uni.navigateBack();
      }, 500);
    },
  });
};
</script>

<style lang="less" scoped>
.box {
  background: #ffffff;
  margin-bottom: 20rpx;
  padding: 32rpx 40rpx;
  .title {
    margin-bottom: 20rpx;
    display: flex;
    align-items: center;
    justify-content: space-between;
    text {
      font-size: 32rpx;
      font-weight: 600;
      color: #333333;
      line-height: 44rpx;
    }
    .btn {
      border-radius: 40rpx;
      border: 2rpx solid #f7f7f7;
      font-size: 28rpx;
      color: #333333;
      line-height: 40rpx;
      padding: 8rpx 20rpx;
    }
  }
  .input_num {
    height: 150rpx;
  }
  .des {
    font-size: 28rpx;
    font-weight: 400;
    color: #bebebe;
    margin-top: 38rpx;
    text {
      color: #1676fd;
    }
  }
  /deep/ .u-cell__body {
    padding-left: 0px;
    padding-right: 0px;
  }
}
.img {
  width: 64rpx;
  height: 64rpx;
  margin-right: 32rpx;
}
.zfbbox {
  display: flex;
  justify-content: space-between;
  margin: 30rpx 0;
  align-items: center;
  padding-bottom: 30rpx;
  border-bottom: 1px solid #f7f7f7;

  .left {
    display: flex;
    .img {
      width: 56rpx;
      height: 56rpx;
    }
    .iconBox {
      position: relative;
      margin-right: 14rpx;
      .img,
      .icon {
        width: 38rpx;
        height: 38rpx;
        position: absolute;
        left: 20rpx !important;
        top: 20rpx !important;
      }
      .icon {
        left: 0;
        top: 0;
      }
    }
    .textBox {
      font-size: 30rpx;
      color: #333333;
      margin-left: 30rpx;
      & > view {
        &:last-child {
          color: #a6a9af;
          font-size: 24rpx;
        }
      }
    }
  }
}
.all_text {
  font-size: 28rpx;
  font-weight: 400;
  color: #1676fd !important;
}
/deep/ .u-border-bottom {
  border-color: #f7f7f7 !important;
}
.sxf {
  font-size: 26rpx;
  font-family: DINPro, DINPro;
  font-weight: 400;
  color: #1e1e1e;
  line-height: 34rpx;
}
</style>
